/**
 * 
 */
package com.terrence.filemgr.mgr.impl.localfs;

import java.io.File;
import java.util.Properties;

import org.apache.commons.lang.StringUtils;

import com.terrence.filemgr.mgr.AbsFileMgrContext;

/**
 * @author wuchuang
 *
 * 2016年11月11日 下午3:00:05
 * 
 * LocalFS上下文信息
 */
public final class LocalFSContext extends AbsFileMgrContext {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2190253199385747883L;
	private final static String DEFAULT_BASE_DIR = System.getProperty("user.home")+File.separatorChar+"fileMgr";
	//本地文件系统基础目录
	private String baseDir = DEFAULT_BASE_DIR;
	
	public LocalFSContext() {
		super();
	}
	
	public static LocalFSContext getInstance(Properties properties){
		LocalFSContext context = new LocalFSContext();
		context.setBaseDir(properties.getProperty("localFS.baseDir", DEFAULT_BASE_DIR));
		context.setIsUnix(StringUtils.equalsIgnoreCase("true",properties.getProperty("localFS.isUnix", "true")));
		context.setEncoding(properties.getProperty("localFS.encoding", "UTF-8"));
		return context;
	}

	public String getBaseDir() {
		return baseDir;
	}

	public void setBaseDir(String baseDir) {
		this.baseDir = baseDir;
	}
	
}
